from flask import Blueprint, request, jsonify
from core.service import LanguageChangeService
from utils.error import ErrorHandler

demo_bp = Blueprint('demo', __name__)
service = LanguageChangeService()
error_handler = ErrorHandler()

@demo_bp.route('/demo', methods=['GET'])
@error_handler.catch_exceptions
def demo():
    data = request.get_json()
    conversation_id = data.get('conversation_id')
    message = data.get('message')
    response = service.converse(conversation_id, message)
    return jsonify({'response': response})
